home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
International Flesh!
/
International Flesh!.iso
/
disk1
/
corpins.ms_
/
corpins.bin
Wrap
Text File
|
1996-06-17
|
6KB
|
237 lines
'**************************************************************************
'* Photo Screen Saver Installation
'**************************************************************************
'$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
''Dialog ID's
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST APPHELP = 900
CONST TOOBIG = 6300
CONST BADPATH = 6400
''Bitmap ID
CONST LOGO = 1
GLOBAL DEST$ ''Default destination directory.
GLOBAL WINDRIVE$ ''Windows drive letter.
GLOBAL WINDIR$ ''Windows directory letter.
GLOBAL NEEDED& ''Number of bytes still needed.
'' List symbol names
GLOBAL EXTRACOSTS$ ''List of extra costs to add per drive
GLOBAL NEEDEDCOSTS$ ''List of costs needed per drive
DECLARE SUB MakeInstallList
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
INIT:
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
SetBitmap CUIDLL$, LOGO
SetTitle "Program Installation"
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "CORPINS.INF"
END IF
ReadInfFile szInf$
DEST$ = "C:\CDEXPRES"
WINDIR$ = GetWindowsDir
WINDRIVE$ = MID$(WINDIR$, 1, 1)
'$IFDEF DEBUG
i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
IF IsDriveValid(WINDRIVE$) = 0 THEN
i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
GOTO QUIT
END IF
'$ENDIF ''DEBUG
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
GETPATH:
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
DEST$ = GetSymbolValue("EditTextOut")
IF sz$ = "CONTINUE" THEN
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO WELCOME
ELSE
GOSUB ASKQUIT
GOTO GETPATH
END IF
MakeInstallList
IF NEEDED& > 0 THEN
GOTO TOOBIG
ELSE
CopyFilesInCopyList
SrcDir$ = GetSymbolValue("STF_SRCDIR")
CreateProgmanItem "CD Express","Photo Viewer - CD Required", MakePath(SRCDIR$,"mss.exe"),"", cmoOverwrite
ini$ = MakePath(WINDIR$, "CONTROL.INI")
CreateIniKeyValue ini$, "ScreenSaver.photo Screensaver ", "IMAGE DIR", DEST$, cmoNone
ini$ = MakePath(WINDIR$, "AD_PREFS.INI")
CreateIniKeyValue ini$, "Photo Screen Saver ", "ImageDir", DEST$, cmoNone
SrcDir$ = GetSymbolValue("STF_SRCDIR")
ini$ = MakePath(WINDIR$, "WIN.INI")
CreateIniKeyValue ini$, "Multimedia Screensaver ", "Wavefile", MakePath(MID$(SRCDIR$,1,3),"mss.wav"), cmoNone
ENDIF
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
dlg% = EXITSUCCESS
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
END
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted, call Desktop Software Inc. at 203-741-8535.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
TOOBIG:
sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO TOOBIG
END IF
UIPop 1
RETURN
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB MakeInstallList STATIC
SrcDir$ = GetSymbolValue("STF_SRCDIR")
CreateDir DEST$, cmoNone
'' Corporate Screensaver Files
AddSectionFilesToCopyList "FILES", SrcDir$, DEST$
'' Windows 3.1 screen saver files
AddSectionFilesToCopyList "WINSAVER", SrcDir$, WINDIR$
'' Images
AddSectionFilesToCopyList "IMAGES", SrcDir$, DEST$
'' Check enough disk space.
EXTRACOSTS$ = "ExtraCosts"
NEEDEDCOSTS$ = "NeededCosts"
FOR i% = 1 TO 26 STEP 1
AddListItem EXTRACOSTS$, "0"
AddListItem NEEDEDCOSTS$, "0"
NEXT i%
''Add extra cost to Windows drive for ini/progman, etc.
ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
NEEDED& = GetCopyListCost(EXTRACOSTS$,NEEDEDCOSTS$,"")
END SUB
'**
'** Purpose:
'** Appends a file name to the end of a directory path,
'** inserting a backslash character as needed.
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** szFile$ - filename to append to directory
'** Returns:
'** Resulting fully qualified path name.
'*************************************************************************
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
IF szDir$ = "" THEN
MakePath = szFile$
ELSEIF szFile$ = "" THEN
MakePath = szDir$
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION